package com.daiyang.librarymanagementsystem2.service;

import com.daiyang.librarymanagementsystem2.entity.BookInfo;
import com.daiyang.librarymanagementsystem2.mapper.BookMapper;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookService {
    @Resource(name="bookMapper")
    BookMapper bookMapper;
    public List<BookInfo> getList(){

        //获取数据
        List<BookInfo> books = bookMapper.mockData();
        //处理⻚⾯展⽰
        for (BookInfo book:books){
            if (book.getStatus()==1){
                book.setStatusCN("可借阅");
            }else {
                book.setStatusCN("不可借阅");
            }
        }
        return books;
    }
}
